//
//  UITableViewCell+CQSetting.m
//  TSListDemo
//
//  Created by qian on 2020/11/18.
//  Copyright © 2020 dvlproad. All rights reserved.
//

#import "UITableViewCell+CQSetting.h"
#import <objc/runtime.h>
#import "UIImage+CQCellBundle.h"

@implementation UITableViewCell (CQSetting)

#pragma mark - runtime
- (CQTableViewCellAccessoryType)cq_accessoryType {
    return [objc_getAssociatedObject(self, @selector(cq_accessoryType)) integerValue];
}

- (void)setCq_accessoryType:(CQTableViewCellAccessoryType)cq_accessoryType {
    objc_setAssociatedObject(self, @selector(cq_accessoryType), @(cq_accessoryType), OBJC_ASSOCIATION_ASSIGN);
    
    switch (cq_accessoryType) {
        case CQTableViewCellAccessoryDisclosureIndicator: {
            UIImageView *goImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 22, 22)];
            goImageView.image = [UIImage cell_nextArrowImage_default];
            self.accessoryView = goImageView;
            break;
        }
        case CQTableViewCellAccessoryNone: {
            self.accessoryType = UITableViewCellAccessoryNone;
        }
        default:
            break;
    }
}

@end
